<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<html>
<head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
    <title>Templates - User Guide</title>
    <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all"/>
</head>

<body>
<h1>Templates</h1>

Use the <span style="font-style: italic; font-weight: bold;">Templates</span> page to add/edit new template types.
 Templates can either be in sequence Templates or endpoint Templates.

As shown in Figure 1 and 2  , the  template management section displays a list of
existing templates. (Defined) templates tab shows templates saved in synapse configuration. Registry templates
tab shows templates saved in registry.
<p></p>
<div class="image">
<img src="images/sequence-template-list.png" alt=""/>

<p>Figure 1: Sequence Template management</p>
</div>

<div class="image">
<img src="images/endpoint-template-list.png" alt=""/>

<p>Figure 2: Endpoint Template management</p>
</div>
In the navigator, under Manage/Service Bus, click <span
style="font-weight: bold;">Templates</span>. The <span
style="font-weight: bold; font-style: italic;">Templates</span>
page appears.

<h3>Managing Sequence Templates</h3>
<ul>
  <li>Enable Statistics
    <ul>
      <li>Click <span style="font-weight: bold;">Enable Statistics</span> to
        gather information relating to a particular sequence template.</li>
    </ul>
  </li>
  <li>Enable Tracing
    <ul>
      <li>Click <span style="font-weight: bold;">Enable Tracing</span> to
        turn on all trace messages for the corresponding sequence template</li>
    </ul>
  </li>
</ul>
The above options are turned off by default because they cause a severe
performance degradation. Use these options only in a situation where you have
to debug a particular problem. Dynamic sequences does not support Enable Statistics and Enable Tracing.  


<ul>
  <li>Edit
    <ul>
      <li>Click <span style="font-weight: bold;">Edit</span> to open the
        sequence template in the design view for editing purposes.</li>
    </ul>
  </li>
  <li>Delete
    <ul>
      <li>Click <span style="font-weight: bold;">Delete</span> to remove a
        particular sequence template from the system.</li>
    </ul>
  </li>
</ul>

<h3>Adding a Sequence Template</h3>
<ol>
  <li style="color: black;">On the <span
    style="font-weight: bold; font-style: italic;">Templates</span>
    page, click <span style="font-weight: bold;">Add Sequence Template</span>. The
    <span style="font-style: italic; font-weight: bold;">Design
    Template</span> page appears.</li>
  <li style="color: black;">Enter a sequence template name.</li>
  <li><span style="color: black;">Click </span><span
    style="font-weight: bold; color: black;">Add Child</span><span
    style="color: black;">, and select the required nodes for your sequence template.
    </span>
    </li>
    
</ol>



<div class="image">
<img src="images/edit-sequence-template.png" alt=""/>

<p>Figure 3: Add sequence template design view</p>
</div>



<h3>Adding parameters to a sequence template</h3>
<ol>
  <li>In case, you want to add parameters to sequence templates,  click on <i>Add Parameter</i> button.
    Then a page appear with a parameter table. You can add and delete parameter name/s.These
    parameter names can be accessed within different child nodes using xpath. example shows how to use
    this in send mediator with xpath</li><br/>
    <div class="image">
    <img alt="" src="images/edit-sequence-template-xpath.png" />
    <p>Figure 3.2: Adding/Accessing sequence template parameters</p>
    </div>
  </ol>
  



<p>Click <span style="font-weight: bold;">switch to source view</span> to
view the XML of the particular sequence tempalte. If you're familiar with the Synapse
configuration language you can edit the XML directly and save the config using this view.</p>



<div class="image">
<img src="images/source-sequence-template.png" alt="Sequence source view"/>

<p>Figure 4: Source view of the sequence template </p>
</div>

<h3>Managing Endpoint Templates</h3>
<ul>
    <li>Edit
        <ul>
            <li>Click <span style="font-weight: bold;">Edit</span> to open the
                endpoint template in the design view for editing purposes.</li>
        </ul>
    </li>
    <li>Delete
        <ul>
            <li>Click <span style="font-weight: bold;">Delete</span> to remove a
                particular endpoint template from the system.</li>
        </ul>
    </li>
</ul>
<p>Note statistics/tracing options are not available for endpoints templates . </p>


<h3>Adding a Endpoint Template</h3>
<ol>
  <li style="color: black;">On the <span
    style="font-weight: bold; font-style: italic;">Templates</span>
    page, click <span style="font-weight: bold;">Add Endpoint Template</span>. The
    <span style="font-style: italic; font-weight: bold;">Add Endpoint Templates</span>
      page appears.</li>
  <li style="color: black;">Select an endpoint template type. currently three types are supported -->,
    <ul>
        <li>Address
        </li>
        <li>Default
        </li>
        <li>Wsdl
        </li>
    </ul>
  </li>

</ol>



<div class="image">
<img src="images/endpoint-template-add.png" alt=""/>

<p>Figure 5.1: Add endpoint template view</p>
</div>

<div class="image">
<img src="images/edit-endpoint-template.png" alt=""/>

<p>Figure 5.2: Add endpoint template design view (for address type)</p>
</div>

<li>Enter the required details in the fields.
    As shown above fields are specific to the Address Endpoint Template.


    <ul>
      <li>Template Name: The unique name for the endpoint template </li>
      <li>Name: a name for the inline endpoint </li>
      <li>Address: The URL of the template endpoint. This can be a parameterized value such as $uri.
          If this is a real endpoint you can test the availability of the given URL on the fly by just
          clicking the <i>Test Address</i>.</li>

    </ul>
  </li>

<h3>Adding parameters to a endpoint template</h3>
<ol>
  <li>you can add parameters to endpoint templates,  click on <i>Add Parameter</i> button
    , a page will appear with a parameter table. You can add and delete parameter name/s.These
    parameter names can be accessed within different attributes of the endpoint template you are currently
    editing. Parameters are accessed with $prefix. For endpoint tempaltes there are two inbuilt paramters
    'name' and 'uri' which can be accessed with $name and $uri. Example shows how to access parameters 'uri' ,
    'p1' and 'p2' for tempalate attributes 'address' , 'suspend error codes' and 'suspend duration'
     respectively
    </li><br/>
    <div class="image">
    <img alt="" src="images/edit-endpoint-template-advanced.png" />
    <p>Figure 6.1: Adding/Accessing sequence template parameters</p>
    </div>
  </ol>




<p>Click <span style="font-weight: bold;">switch to source view</span> to
view the XML of the particular endpoint template. As pointed out earlier ,If you're familiar with the Synapse
configuration language you can edit the XML directly and save the config using this view.</p>



<div class="image">
<img src="images/source-endpoint-template.png" alt="Endpoint Template source view"/>

<p>Figure 6.2: Source view of the endpoint template </p>
</div>


<p>For <a href="http://wso2.org/library/esb">more information</a> please refer to the WSO2 library</p>
</body>
</html>
